import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import 'amfe-flexible';
import common from '@/common/index.js';
import '@/style/theme.css';
import { Toast, Dialog, Notify } from 'vant';
import api from '@/api';

const app = createApp(App);
router.beforeEach(async(to,from)=>{
    // const token = storage.get(ACCESS_TOKEN);
    // if (!token) {
    //     const res = await api.brandApi.getToken(storage.get(BRANDID) ?? 1);
    //     if (res.success) {
    //         // sessionStorage.setItem('token', res.access_token)
    //         storage.set(ACCESS_TOKEN,res[ACCESS_TOKEN], res.expires_in)
    //     }
    // }
    console.log(to,'to')
    if(to.meta.title){
        document.title = to.meta.title
    }
    return true
})
app.config.globalProperties.$http = api

app.use(store).use(router).use(common).use(Toast).use(Dialog).use(Notify).mount('#app')
